<?php
/* Smarty version 3.1.31, created on 2019-08-19 16:07:55
  from "/data/www/wwwroot/phprap/application/home/view/project/search.html" */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.31',
  'unifunc' => 'content_5d5a58db44a147_66088765',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'e9f1bef5eff116baacfb7372b7d75aa1efb7a7de' => 
    array (
      0 => '/data/www/wwwroot/phprap/application/home/view/project/search.html',
      1 => 1564463076,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_5d5a58db44a147_66088765 (Smarty_Internal_Template $_smarty_tpl) {
if (!is_callable('smarty_function_include_file')) require_once '/data/www/wwwroot/phprap/application/common/smarty/function.include_file.php';
if (!is_callable('smarty_modifier_truncate')) require_once '/data/www/wwwroot/phprap/vendor/smarty/smarty/libs/plugins/modifier.truncate.php';
echo smarty_function_include_file(array('name'=>'public/header','title'=>'搜索项目'),$_smarty_tpl);?>


</head>

<body>

<div id="wrapper">

    <!-- Navigation -->
    <?php echo smarty_function_include_file(array('name'=>'public/nav','sidebar'=>'user_sidebar'),$_smarty_tpl);?>

    <div id="page-wrapper">

        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">搜索项目</h1>
                <div class="search">
                    <div class="well">

                        <form class="form-inline" action="<?php echo url();?>
" method="get">
                            <div class="form-group">
                                <label>项目名</label>
                                <input name="search[project]" type="text" class="form-control" placeholder="支持模糊查询" value="<?php echo $_smarty_tpl->tpl_vars['search']->value['project'];?>
">
                            </div>

                            <div class="form-group">
                                <label>创建人</label>
                                <input name="search[user]" type="text" class="form-control" placeholder="支持模糊查询" value="<?php echo $_smarty_tpl->tpl_vars['search']->value['user'];?>
">
                            </div>

                            <button type="submit" class="btn btn-primary">搜索</button>
                        </form>

                    </div>
                </div>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">

                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="table-responsive">
                            <table class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>项目名称</th>
                                    <th>项目简介</th>
                                    <th>创建人/账号</th>
                                    <th>成员数</th>
                                    <th>创建时间</th>

                                    <th>操作面板</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php if ($_smarty_tpl->tpl_vars['projects']->value) {?>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['projects']->value, 'project');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['project']->value) {
?>
                                <?php $_smarty_tpl->_assignInScope('project_id', $_smarty_tpl->tpl_vars['project']->value['id']);
?>
                                <?php $_smarty_tpl->_assignInScope('user_id', $_smarty_tpl->tpl_vars['project']->value['user_id']);
?>
                                <tr>
                                    <td ><?php echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['project']->value['title'],10);?>
</td>
                                    <td ><?php echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['project']->value['intro'],30);?>
</td>
                                    <td ><?php echo _uri('user',$_smarty_tpl->tpl_vars['user_id']->value,'name');?>
<br><?php echo _uri('user',$_smarty_tpl->tpl_vars['user_id']->value,'email');?>
</td>
                                    <td ><?php echo \app\project::get_member_num($_smarty_tpl->tpl_vars['project_id']->value);?>
</td>
                                    <td ><?php echo $_smarty_tpl->tpl_vars['project']->value['add_time'];?>
</td>
                                    <td >

                                        <?php if (\app\user::is_creater($_smarty_tpl->tpl_vars['project_id']->value)) {?>
                                        <a class="btn btn-info btn-xs disabled">创建者</a>
                                        <?php } elseif (\app\user::is_joiner($_smarty_tpl->tpl_vars['project_id']->value)) {?>
                                        <a class="btn btn-warning btn-xs disabled">参与者</a>
                                        <?php } elseif (\app\user::is_appling($_smarty_tpl->tpl_vars['project_id']->value)) {?>
                                        <a class="btn btn-default btn-xs disabled">审核中</a>
                                        <?php } else { ?>
                                        <a class="btn btn-success btn-xs js_addProjectBtn" data-project_id="<?php echo $_smarty_tpl->tpl_vars['project']->value['id'];?>
">加入项目</a>
                                        <?php }?>

                                    </td>
                                </tr>
                                <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);
?>

                                <?php }?>

                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <div class="col-sm-12">
                <?php echo smarty_function_include_file(array('name'=>'public/page'),$_smarty_tpl);?>

            </div>

            <!-- /.col-lg-6 -->
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->
    <hr>
    <p class="text-center"><?php echo get_config('copyright');?>
</p>

    <?php echo '<script'; ?>
>
        $(function () {
            $(".js_addProjectBtn").click(function () {
                var thisObi = $(this);
                var url = "<?php echo url('apply');?>
";
                var projectId = thisObi.data('project_id');

                $.post(url, { project_id:projectId }, function(json){
                    if(json.code == 200 || json.code == 304){

                        thisObi.removeClass('btn-success').addClass('btn-default').attr("disabled", "disabled").text('审核中');

                    }else{

                        thisObi.text('重新提交').removeAttr("disabled");
                    }

                    alert(json.msg, 2000);

                }, 'json');
            });
        });
    <?php echo '</script'; ?>
>

    <?php echo smarty_function_include_file(array('name'=>'public/footer'),$_smarty_tpl);?>

<?php }
}
